<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<!--<link rel="stylesheet" type="text/css" href="../css/reset.css"/>-->
		<link rel="stylesheet" type="text/css" href="../css/style.css"/>
		<link rel="stylesheet" type="text/css" href="../css/header.css"/>
		<link rel="stylesheet" type="text/css" href="../css/modifyPassword.css"/>
		<script src="../js/flexible.debug.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<header class="header">
			<span class="span fanghui"><img src="../img/fanhui.png"/></span>
			<span class="span">修改密码</span>
			<span class="span"></span>
		</header>
		<main class="mains">
			<section class="section">
				<div>
	                <span>登录密码：</span>
	                <input id="ipt" type="text" placeholder="填写当前登录密码">
	            </div>
			    <div>
	                <span>设置新密码：</span>
	                <input id="ipt_one" type="password" placeholder="6~20位字母.数字组合">
	            </div>
			    <div>
	                <span>确认新密码:</span>
	                <input id="ipt_two" type="password" placeholder="6~20位字母.数字组合">
	            </div>
	            <button class="button">完成</button>
			</section>	
			
		</main>
		<script src="../js/jquery-1.12.4.min.js"></script>
	       <script>
	       	
	     
	      
	       	$(function($){
	       		
	       
	       	$.ajax({
	       		type:"get",
	       		url:"../user.json",
	       		async:true,
	       		success:function(data1){
	       			$.each(data1, function(i,n) {
	       				 user =   n.admin;
	       				 pas =   n.pas;
	       				 pasone =   n.pastwo
	       			});
	       			//console.log(data)
	       			
	       			$(".button").click(function(event){
	       				var val = $("#ipt").val();
	       	var val1 = $("#ipt_one").val();
	       	var val2 = $("#ipt_two").val();
	       				
	       				 	$.ajax({
	       		type:"post",
	       		url:"http://172.16.24.216:8080/login",
	       		async:true,
	       		data:{
	       			  "user":val,
	       			  "pas":val1,
	       			  "five":val2
	       		},
	       		success:function(data){
	       			if(val==user && val1==pas  && val2==pasone ){
	       					
	       					alert(data[0].pas)	
	       				}
	       				else{
	       					alert("账号或密码错误")
	       				}
	       			console.log(data)
	       		}
	       	});
	       				
	       			})
	       		}
	       	});
	       	
	       		})
	       	
	       	
	       	 $('.fanghui').click(function(){
                location.href="myInformation.html";
            });
	      $('.button').click(function(){
                location.href="myInformation.html";
            });
	       	
	       </script>
	</body>
</html>
